package cn.xfdzx.android.apps.shop.fragment.home.presenter;

import android.util.Log;

import cn.xfdzx.android.apps.shop.base.BasePresenterImp;
import cn.xfdzx.android.apps.shop.base.NetCallBackImpl;
import cn.xfdzx.android.apps.shop.fragment.home.contract.MarketShopNearContract;
import cn.xfdzx.android.apps.shop.fragment.home.model.IHomeMarketMode;
import cn.xfdzx.android.apps.shop.fragment.home.model.MarketNearGoodsModel;
import cn.xfdzx.android.apps.shop.fragment.home.request.NearShopRequest;
import cn.xfdzx.android.apps.shop.fragment.home.response.HomeNearShop;
import cn.xfdzx.android.apps.shop.util.ToastUtil;

public class MarketShopNearPresenter  extends BasePresenterImp<MarketShopNearContract.View, IHomeMarketMode>implements MarketShopNearContract.Presenter {

    private static final String TAG = "MarketShopNearPresenter";
    @Override
    public IHomeMarketMode createModel() {
        return new MarketNearGoodsModel();
    }


    @Override
    public void getNearShop(NearShopRequest nearShopRequest) {

        mView.showLoading();
        mModel.getNearShopsData(nearShopRequest, new NetCallBackImpl<HomeNearShop>(mView) {
            @Override
            public void onSuccess(HomeNearShop o) {

                Log.d(TAG, "onSuccess: "+o.toString());
                mView.onSuceessData(o);
                mView.hideLoading();
            }

            @Override
            public void onFailure(String reason) {

                mView.onFail(reason);
                mView.hideLoading();
            }
        });
    }
}
